package com.vcs.frm.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.vcs.frm.dao.CommonDao;
import com.vcs.frm.domain.City;
import com.vcs.frm.domain.Designation;
import com.vcs.frm.domain.NoticeBoard;
import com.vcs.frm.domain.State;
import com.vcs.frm.domain.User;

public class CommonServiceImpl implements CommonService {

	@Autowired
	private CommonDao commonDao;

	public void setCommonDao(CommonDao commonDao) {
		this.commonDao = commonDao;
	}

	@Override
	public List<State> getAllStates() {
		List<State> states = commonDao.getAllStates();
		return states;
	}

	@Override
	public List<City> getCitiesByState(int stateId) {
		List<City> cities = commonDao.getCitiesByState(stateId);
		return cities;
	}

	@Override
	public NoticeBoard getNoticeBoard() {
		NoticeBoard nb = commonDao.getNoticeBoard();
		return nb;
	}

	@Override
	@Transactional
	public int updateNoticeBoards(NoticeBoard noticeBoard) {

		int status = commonDao.updateNoticeBoard(noticeBoard);
		return status;
	}

	/**
	 * 
	 */
	@Override
	@Transactional
	public User createUserAndSetRoles(String firstName, List<String> authorities) {
			
		
		return null;
	}

	/**
	 * Gets User and set of his roles
	 */

	@Override
	public User getUser(int userId) {
		User user = commonDao.getUser(userId);
		return user;
	}

	@Override
	public List<Designation> getDesignationList() {
		List<Designation> lst = commonDao.getDesignationList();
		return lst;
	}

	@Override
	public int updateNoticeBoard(NoticeBoard noticeBoard) {
		int status = commonDao.updateNoticeBoard(noticeBoard);
		return status;
	}

	@Override
	public List<String> getEnums(String enumGroup) {
		List<String> enums = commonDao.getEnums(enumGroup);
		return enums;
	}

}
